package com.zhang.first.day02;

import com.zhang.first.utils.IntegerSource;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

/**
 * @title: reduce -> max,min
 * @author: zhang
 * @date: 2022/1/16 09:16
 */
public class Example5 {
    public static void main(String[] args) throws Exception {
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
        env.setParallelism(1);

        env
                .addSource(new IntegerSource())
                .keyBy(r -> 1)
                .max(0)
                .print();

        env
                .addSource(new IntegerSource())
                .keyBy(r -> 1)
                .min(0)
                .print();

        env.execute();

    }
}
